Grok Imagine - Image Upscale
Enhance image resolution and quality using advanced AI upscaling powered by Grok
Task ID Source
Thetask_id parameter should be obtained from a previously generated image task. You can upscale images that were created using:
Generate Images First
Create images using the text-to-image model to get a task ID for upscaling
- Use the Text to Image API to generate images
- Extract the
taskIdfrom the API response - Use that
taskIdas thetask_idparameter in the upscale request
Only images generated by Apikley models can be upscaled. External images are not supported.
Query Task Status
After submitting an upscale task, use the unified query endpoint to check progress and retrieve results:Get Task Details
Learn how to query task status and retrieve generation results
For production use, we recommend using the
callBackUrl parameter to receive automatic notifications when upscaling completes, rather than polling the status endpoint.Related Resources
Rate limits and quotas are enforced by Apikley and may differ from upstream providers.
OpenAPI
market/grok-imagine/upscale.json post /api/v1/jobs/createTask
Copy
openapi: 3.0.0
info:
title: Grok Imagine API
description: Apikley Grok Imagine API Documentation - Image Upscaling
version: 1.0.0
contact:
name: Technical Support
email: [email protected]
servers:
- url: https://api.apikley.ru
description: API Server
security:
- BearerAuth: []
paths:
/api/v1/jobs/createTask:
post:
summary: Upscale Grok Imagine Images
description: >-
Create a new Grok Imagine image upscaling task using the
grok-imagine/upscale model.
### Important Notes
- Only images generated by Apikley models can be upscaled
- The task_id must be from a previously successful image generation task
- Upscaled images are processed asynchronously
- Use the returned taskId to track upscaling progress
- Callback URL is recommended for production use to receive automatic
notifications when upscaling completes
- Upscaled image URLs are valid for 24 hours - download and store images
immediately
### Generation Time
Image upscaling typically takes:
- **Standard quality**: 8-12 seconds
- **High resolution images**: 12-18 seconds
### Rate Limits
- Maximum 40 concurrent tasks per account
- Maximum 400 task creations per hour
- One image per request
### Supported Input
This API only supports upscaling images that were previously generated
using Apikley models. The task_id must be obtained from:
- **grok-imagine/text-to-image**: Images generated from text prompts
- **Other Apikley image generation models**: Any image generation task
from supported models
External images or images from other services cannot be upscaled using
this API.
### Best Practices
**Input Selection:**
- Use task IDs from recently generated images (within the last 24 hours)
- Ensure the original image generation was successful
- Higher quality original images produce better upscaling results
**Workflow:**
1. Generate an image using text-to-image API
2. Extract the taskId from the generation response
3. Use that taskId to upscale the image
4. Download the upscaled result immediately
### Common Issues
**Invalid task_id:** Ensure the task_id comes from a successful image
generation and hasn't expired
**Task not found:** The original image generation task may have expired
or been deleted
**Upscaling failed:** The original image may not be suitable for
upscaling or may be corrupted
operationId: grok-imagine-upscale
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
model:
type: string
enum:
- grok-imagine/upscale
default: grok-imagine/upscale
description: |-
The model name to use for generation. Required field.
- Must be `grok-imagine/upscale` for this endpoint
example: grok-imagine/upscale
callBackUrl:
type: string
format: uri
description: >-
The URL to receive image upscaling task completion updates.
Optional but recommended for production use.
- System will POST task status and results to this URL when
upscaling completes
- Callback includes generated upscaled image URLs and task
information
- Your callback endpoint should accept POST requests with
JSON payload containing image results
- Alternatively, use the Get Task Details endpoint to poll
task status
example: https://your-domain.com/api/callback
input:
type: object
description: Input parameters for the image upscaling task
properties:
task_id:
type: string
description: >-
Task ID from a previously successful image generation
task. Required field.
- Must be from a Apikley image generation model (e.g.,
grok-imagine/text-to-image)
- The original image generation must have completed
successfully
- Maximum length: 100 characters
- Only Apikley–generated task IDs are supported
maxLength: 100
example: task_grok_12345678
required:
- task_id
required:
- model
- input
example:
model: grok-imagine/upscale
callBackUrl: https://your-domain.com/api/callback
input:
task_id: task_grok_12345678
responses:
'200':
description: Request successful
content:
application/json:
schema:
allOf:
- $ref: '#/components/schemas/ApiResponse'
- type: object
properties:
data:
type: object
properties:
taskId:
type: string
description: >-
Task ID, can be used with Get Task Details
endpoint to query task status
example: task_grok_upscale_12345678
example:
code: 200
msg: success
data:
taskId: 281e5b0*********************f39b9
'500':
$ref: '#/components/responses/Error'
callbacks:
onImageUpscaled:
'{$request.body#/callBackUrl}':
post:
summary: Image Upscaling Callback
description: >-
When the image upscaling task is completed, the system will send
the result to your provided callback URL via POST request
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
code:
type: integer
description: >-
Status code
- **200**: Success - Image upscaling completed
successfully
- **501**: Failed - Image upscaling task failed
enum:
- 200
- 501
msg:
type: string
description: Status message
example: Playground task completed successfully.
data:
type: object
properties:
taskId:
type: string
description: Task ID
example: 281e5b0*********************f39b9
example:
code: 200
msg: Playground task completed successfully.
data:
taskId: 281e5b0*********************f39b9
responses:
'200':
description: Callback received successfully
components:
schemas:
ApiResponse:
type: object
properties:
code:
type: integer
enum:
- 200
- 401
- 402
- 404
- 422
- 429
- 455
- 500
- 501
- 505
description: >-
Response status code
- **200**: Success - Request has been processed successfully
- **401**: Unauthorized - Authentication credentials are missing or
invalid
- **402**: Insufficient Credits - Account does not have enough
credits to perform the operation
- **404**: Not Found - The requested resource or endpoint does not
exist
- **422**: Validation Error - The request parameters failed
validation checks
- **429**: Rate Limited - Request limit has been exceeded for this
resource
- **455**: Service Unavailable - System is currently undergoing
maintenance
- **500**: Server Error - An unexpected error occurred while
processing the request
- **501**: Generation Failed - Image upscaling task failed
- **505**: Feature Disabled - The requested feature is currently
disabled
msg:
type: string
description: Response message, error description when failed
example: success
responses:
Error:
description: Server Error
securitySchemes:
BearerAuth:
type: http
scheme: bearer
bearerFormat: API Key
description: >-
All APIs require authentication via Bearer Token.
Get API Key:
1. Visit [API Key Management Page](https://app.apikley.ru/keys) to get your
API Key
Usage:
Add to request header:
Authorization: Bearer APIKLEY_API_KEY
Note:
- Keep your API Key secure and do not share it with others
- If you suspect your API Key has been compromised, reset it immediately
in the management page
To find navigation and other pages in this documentation, fetch the llms.txt file at: https://docs.apikley.ru/llms.txt